<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <title>{{ .title }}</title>
</head>

<body>
<div>
    <video id='myvideo' width=960 height=540 controls
    src="{{ .hlsUrl }}"
    >
    </video>
    <div>
        {{ range .playlist }}
        <a href="javascript:;" onclick="repush('/repush?name={{ . }}')"> {{ . }} </a>
        <br/>
        {{ end }}
    </div>
</div>
<script>
    function repush(url) {
        const httpRequest = new XMLHttpRequest();//第一步：建立所需的对象
        httpRequest.open('GET', url, true);//第二步：打开连接  将请求参数写在url中  ps:"./Ptest.php?name=test&nameone=testone"
        httpRequest.send();//第三步：发送请求  将请求参数写在URL中
        /**
         * 获取数据后的处理程序
         */
        setTimeout(location.reload, 5000)
        // location.reload();
    }
</script>
</body>